<?php
/*******************************************************************************
 * $Date:: Jan 20, 2011 4:34:43 PM                                              $
 * $Revision:                                                                  $
 * $Author:: Tuan Duong                                                        $
 * $Comment::                                                                  $
 ******************************************************************************/ 
/**
 * Description here...
 * 
 * @package Lua
 * @subpackage ##Subpackage##
 * @author Tuan Duong <bacduong[at]gmail[dot]com>
 * @version 
 */

class Lua_Grid_Column_Date extends Lua_Grid_Column_Abstract
{
    private $format = '%d/%m/%Y %H:%M:%S';
    public function __construct($key, $params = array())
    {
        if (isset($params['format']) && $params['format']) {
            $this->format = $params['format'];
        }
        parent::__construct($key, $params);
//        $this->sortable = false;
    }
    public function renderCell($value = '', $rows = array())
    {
        return parent::cell(strftime($this->format, strtotime($value)));
    }
    public function setDateFormat($format) {
        $this->format = $format;
    }
}